<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php $this->load->view('common/head');?>

<?php $this->load->view('common/header');?>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar');?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs');?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set');?>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="cf">
                            <a class="btn btn-info" href="javascript:;" id="add" value="">新增</a>
                        </div>
                        <div class="space-4"></div>
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th class="col-xs-2">变量说明</th>
                                <th class="col-xs-2">变量名称</th>
                                <th class="col-xs-3">变量值</th>
                                <th class="col-xs-1">排序</th>
                                <th class="col-xs-1">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(isset($vars) && !empty($vars)) { ?>
                            <?php foreach ($vars as $key => $val) { ?>
                                <tr>
                                    <td><?php echo $val['name']; ?></td>
                                    <td><?php echo $val['k']; ?></td>
                                    <td><?php echo $val['v']; ?></td>
                                    <td><?php echo $val['ord']; ?></td>
                                    <td><a href="<?php echo site_url(X_URL.'variable/edit/'.$val['k']);?>"><i
                                            class="ace-icon fa fa-pencil bigger-100"></i>修改</a>&nbsp&nbsp;<a
                                            href="javascript:;" val="<?php echo site_url(X_URL.'variable/del/'.$val['k']);?>" class="dellink"><i
                                            class="ace-icon fa fa-trash-o bigger-100 red"></i>删除</a></td>
                                </tr>
                            <?php }?>
                            <?php }?>
                            </tbody>
                        </table>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    </div><?php $this->load->view('common/footer');?>



<?php $this->load->view('common/footerjs');?>
<!-- inline scripts related to this page -->
<script>
    $(".dellink").click(function () {
        var url = $(this).attr('val');
        bootbox.confirm({
            title: "系统提示",
            message: "是否要删除该记录？",
            callback: function (result) {
                if (result) {
                    window.location.href = url;
                }
            },
            buttons: {
                "cancel": {"label": "取消"},
                "confirm": {
                    "label": "确定",
                    "className": "btn-danger"
                }
            }
        });
    });
    $("#add").click(function () {
        window.location.href="add";
    });
</script>
</body>
</html>